package com.example.day5_fragment2.fragment;


import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.day5_fragment2.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class TwoFragment extends Fragment {
    public static Handler handler = new Handler(){
        @Override
        public void handleMessage(@NonNull Message msg) {
            super.handleMessage(msg);
            int what = msg.what;
            if(what == 101){
                String string = (String) msg.obj;
                textView.setText(string);
            }
        }
    };
    static TextView textView;

    public TwoFragment() {

    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_two, container, false);
        textView = view.findViewById(R.id.tv);
        return view;
    }

}
